08. Other Facets of C++ Classes
Other Facets of C++ Classes
If you haven't taken one yet, now might be a good time to take a stretch break. We've still got three more topics to cover before you code your own class:
- Private versus Public
- Header Files
- Inclusion Guards
As you'll see in the next lesson node, private variables and functions are only available within your class code. Public functions and variables, on the other hand, are accessible within your class and also by an object of the class.
You are already familiar with header files from the "C++ Getting Started" lesson. While header files are not needed to run code, they are very helpful for organizing and reusing code. We'll explain how to use header files when organizing your C++ code.
C++ compilers do not like it when your code declares the same variables, functions or classes more than once. As your code gets longer and more complex, you'll oftentimes include more than one header file at the top of your code. These header files could contain the same class or function declarations, and then your code won't compile. You'll see how to avoid this situation in the "Inclusion Guards" lesson node.
Continue on to learn about these three aspects of C++ programming.